﻿

<script  type="text/javascript">
    $(document).ready(function () {
        $("#logon").click(function () {
            var parameter = {
                'username' : $("#email").val(),
                'password' : $("#password").val(),
            };
            $.post("/account/logon",parameter,function(data){
          
              if(data == true)
              { 
                location.reload();
                $('#mask , .login-popup').fadeOut(300, function () {
                $('#mask').remove();
                 return false;
                });
              }
              else
              {
                $("#showerror").html(data);
              }
               
                 
            });
        });
    })
</script>

@if (Session["user"] == null)
{
<div class="container-pp">
	 <div id="content-pp">
		<div class="post">
        	<div class="btn-sign">
				<a href="#login-box" class="login-window">Đăng Nhập</a>
                |
               <a href="/account/register" >Đăng Ký</a>
        	</div>
		</div>
        <div id="login-box" class="login-popup">
        <a href="#" class="close"><img src="../../Images/frmLogin/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
          <form method="post" class="popup-frm" action="account/logon">
            <h2 class="title-login">ĐĂNG NHẬP</h2>
                <fieldset class="textbox">
                    <ul class="username">
                        <li class="label"><label >Username</label></li>
                        <li><input  name="username" id="email" class="text" type="text" autocomplete="on" placeholder="Username" /></li>
                    </ul>
            	    <ul class="password"> 
                       <li class="label"><label >Password</label></li> 
                       <li><input  name="password" id="password" class="text"  type="password" placeholder="Password" /></li>
                    </ul>
                    <ul>
                        <li><button class="submit button" type="button" id="logon"  >Đăng Nhập</button></li>
                         @Html.Hidden("returnURL", ViewContext.HttpContext.Request.Url.PathAndQuery)
                    </ul>  
                    <ul><div style="color:Red" id="showerror"></div></ul>              
                </fieldset>
          </form>
		</div>
    </div>
</div>
}
else
{
 
     <label></label>
    <div class="container-pp">       
	 <div id="content-pp">
		<div class="post">
        	<div class="btn-sign">
				Chào bạn!<a href="" class="login-window">  @Session["user"].ToString()</a>
                |
               <a href="/account/logoff" >Thoát</a>
        	</div>
		</div>
        <div id="login-box" class="login-popup">
        <a href="#" class="close"><img src="../../Images/frmLogin/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
          <form method="post" class="popup-frm" action="#">
            <h2 class="title-login">ĐĂNG NHẬP</h2>
                <fieldset class="textbox">
                    <ul class="username">
                        <li class="label"><label >Username</label></li>
                        <li><input  name="email" id="email" class="text" type="text" autocomplete="on" placeholder="Username" /></li>
                    </ul>
            	    <ul class="password"> 
                       <li class="label"><label >Password</label></li> 
                       <li><input  name="password" id="password" class="text"  type="password" placeholder="Password" /></li>
                    </ul>
                    <ul>
                        <li><button class="submit button" type="button" onclick="a('frmct')" >Đăng Nhập</button>   </li>

                         @Html.Hidden("returnURL", ViewContext.HttpContext.Request.Url.PathAndQuery)
                       
                    </ul>                
                </fieldset>
          </form>
		</div>
    </div>
</div>

    
}
